package at.fhj.pse.datasource.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;

import at.fhj.pse.datasource.ActivityDAO;
import at.fhj.pse.datasource.model.Activity;

public class ActivityDAOImpl implements ActivityDAO {

	private final Logger LOG = Logger
			.getLogger(ActivityDAOImpl.class.getName());

	// see META-INF/persistence.xml for persistence unit configuration
	@Inject
	private EntityManager em;

	public List<Activity> getActivities() {
		List<Activity> activities = new ArrayList<Activity>();
		TypedQuery<Activity> query = (TypedQuery<Activity>) this.em
				.createQuery("Select a FROM Activity a", Activity.class);
		activities = query.getResultList();
		return activities;
	}

}
